﻿using System;
using System.Windows;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml which is the window where the user chooses the assignment name, type
    /// and assignment text
    /// </summary>
    public partial class Window1 : Window
    {
        private int i;

        public Window1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Continues to the second step of creating an assignment if all requirements are met
        /// </summary>
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "")
            {
                var assignment = new Assignment();
                assignment.AddBasicInformation(textBox2.Text, textBox1.Text, i);
                var step2 = new Window2(assignment);
                this.Close();
                step2.Show();
            }
            else
            {
                MessageBox.Show("Mulige fejl:"
                    + Environment.NewLine + Environment.NewLine +  
                              "Du har ikke skrevet opgavenavn"
                              + Environment.NewLine + Environment.NewLine +  
                              "Du har ikke skrevet opgavetekst.");
            }
        }

        /// <summary>
        /// Following two methods sets the assignment type depending on which radiobutton is checked.
        /// </summary>
        private void radioButton1_Checked(object sender, RoutedEventArgs e)
        {
            i = 1;
        }

        private void radioButton2_Checked(object sender, RoutedEventArgs e)
        {
            i = 0;
        }

        /// <summary>
        /// Help button showing how to use the current window.
        /// </summary>
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(
                "Denne side bruges til at sige hvad opgavens navn skal være og hvilken type opgave der er tale om" +
                System.Environment.NewLine + System.Environment.NewLine +
                "Der kan være tale om to typer af opgaver, staveopgave eller en quiz" +
                System.Environment.NewLine + System.Environment.NewLine +
                "Sidst men ikke mindst er den store box i midten der hvor opgaveteksten skrives ind. Skriv hele teksten uden mangler i dette vindue og tryk derefter på næste trin.");
        }


    }
}
